﻿@model IEnumerable<Web.Areas.Admin.Models.Opus>

@{
    ViewBag.Title = "作品推荐";
    Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
}
@section header{
<script language="javascript" type="text/javascript" src="@Url.Content("~/Scripts/My97DatePicker/WdatePicker.js")"></script>
<style type="text/css">
    .gridColCheck{width:10%;}
    </style>
    <script type="text/javascript">
        $(function () {
            $("input[type='radio']").each(function () {
                $(this).click(function () {
                    $("#btnEdit").attr("href", "/Admin/Opus/Edit/" + $(this).attr("value"));
                    $("#btnDel").attr("href", "/Admin/Opus/Del/" + $(this).attr("value"));
                });
            });
        });
        function cusval() {
            var slt = $("input[type='radio']:checked").val();
            if (!slt) {
                alert("请选择要操作的数据！");
                return false;
            } else {
                return true;
            }
        }
        function cusDel() {
            var slt = $("input[type='radio']:checked").val();
            if (!slt) {
                alert("请选择要操作的数据！");
                return false;
            } else {
                return confirm('你确定要删除么？');
            }
        }
    </script>
}
<div class="nav">当前位置 :-> 作品推荐</div>
<div class="toolbar">
    @Html.ActionLink("添加", "Add", "Opus", new { area = "Admin" }, null)
    @Html.ActionLink("编辑", "Edit", "Opus", new { area = "Admin" }, new { @id = "btnEdit", onclick = "return cusval()" })
    @Html.ActionLink("删除", "Del", "Opus", new { area = "Admin" }, new { @id = "btnDel", onclick = "return cusDel()" })
    @Html.ActionLink("刷新", "Index", "Opus", new { area = "Admin" }, null)
</div>
<div class="searchbar">
    @using (Html.BeginForm())
    {
    @Html.Label("tbxSearchOpusID", "作品编号：") @Html.TextBox("tbxSearchOpusID", "")
    @Html.Label("tbxSearchOpusName", "作品名称：") @Html.TextBox("tbxSearchOpusName", "")
    @Html.Label("tbxSearchOpusTypeName", "作品类别：") @Html.TextBox("tbxSearchOpusTypeName", "")<br />  
    @Html.Label("tbxSearchIsValid", "是否有效：") @Html.TextBox("tbxSearchIsValid", "")
    @Html.Label("tbxSearchIsTop", "首页显示：") @Html.TextBox("tbxSearchIsTop", "")<br />
    @Html.Label("tbxSearchOpusBeginDate", "日期介于：") @Html.TextBox("tbxSearchOpusBeginDate", "", new { @onfocus = @"WdatePicker({maxDate:'#F{$dp.$D(\'tbxSearchOpusEndDate\')||\'2020-10-01\'}',dateFmt:'yyyy-MM-dd HH:mm:ss'})" })
    <text>和</text>
    @Html.TextBox("tbxSearchOpusEndDate", "", new { @onfocus = @"WdatePicker({minDate:'#F{$dp.$D(\'tbxSearchOpusBeginDate\')}',maxDate:'2020-10-01',dateFmt:'yyyy-MM-dd HH:mm:ss'})" })  
    <input type="submit" value="搜索" />
    }
</div>
<hr />
@{var grid = new WebGrid(source: Model, defaultSort: "OpusID", rowsPerPage: 10);}

@grid.GetHtml(
tableStyle: "grid",
headerStyle: "head",
alternatingRowStyle: "alt",
htmlAttributes: new { width = "100%" },
columns: grid.Columns(
grid.Column(format: @<text><input type="radio" name="rdoOpus" value="@item.OpusID" /></text>),
                    grid.Column("OpusID", "编号"),
                    grid.Column("OpusName", "作品名称", format: @<text><span title="@item.OpusName">@Html.FormatStr((string)item.OpusName, 10)</span></text>),
                                                                    grid.Column("OpusStylistName", "所属设计师"),
                                                                    grid.Column("OpusStylistDate", "发布时间"),
                                                                grid.Column("IsTop", "首页显示"),
                    grid.Column("IsValid", "是否生效")
)
)

